package cn.client.ui.components

import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.PopupProperties


/**
 * 基础顶部栏，带标题和返回点击事件
 */
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun BaseTopBar(
    title: String,
    onClickArrowBack: () -> Unit
){
    TopAppBar(
        colors = TopAppBarDefaults.topAppBarColors(
            containerColor = MaterialTheme.colorScheme.primaryContainer,
            titleContentColor = MaterialTheme.colorScheme.primary
        ),
        title = { Text(title) },
        /* 左边按钮 */
        navigationIcon = {
            IconButton(onClick = {
                onClickArrowBack()
            }) {
                Icon(Icons.AutoMirrored.Filled.ArrowBack, null)
            }
        },
        /* 右边按钮（可以是多个） */
        actions = {
//            IconButton(onClick = {
//
//            }
//            ) { Icon(Icons.Filled.MoreVert, null)
//
//            }
            Spacer(modifier = Modifier.size(24.dp))
        })
}